import request from '@/utils/request'

// 获取
export const getAPI = data => {
  return request({
    method: 'get',
    url: '/data',
    params: data
  })
}

// 搜索
export const searchAPI = val => {
  return request({
    url: `/data/?name=${val}`,
    method: 'GET'
  })
}

// 删除
export const delAPI = id => {
  return request({
    method: 'DELETE',
    url: `/data/${id}`
  })
}

// 新增
export const addAPI = data => {
  return request({
    method: 'POST',
    url: `/data`,
    data
  })
}

// 编辑
export const updateAPI = data => {
  return request({
    method: 'put',
    url: `/data/${data.id}`,
    data
  })
}

// 获取详情--回填
export const API = id => {
  return request({
    method: 'get',
    url: `/data/${id}`
  })
}
